package com.byxy.controller;

import java.util.Date;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;

import com.byxy.entity.Reply;
import com.byxy.entity.User;
import com.byxy.service.ReplyService;

@Controller
public class ReplyController {
	
	@Autowired
	private ReplyService replyService;
	
	@PostMapping("publishReply.do")
	public String myReply(Reply reply,HttpSession session) {
//		session.setAttribute("tipId", reply.getTipId());
		User u = (User) session.getAttribute("USER");
		reply.setReplyModifyTime(new Date());
		reply.setReplyPublishTime(new Date());
		reply.setReplyStatus(0);
		replyService.myReply(reply);
		return "redirect:showTip.do";
	}

}
